<!DOCTYPE html>
	<html lang="en">
	<head>
		<meta charset="UTF-8">
		<meta name="viewport" content="width=device-width,initial-scale=1.0">
		<title>Document</title>
		<link rel="stylesheet" href="../layui/css/layui.css">
		<link rel="stylesheet" type="text/css" href="../css/details-c.css">
	</head>
	<style type="text/css">
            #paymentpaw{
            top:0;
            width: 100%;
            position:fixed;
            width: 100%;
            height: 100%;
            display: none;
            z-index: 9999;
            background: rgba(0,0,0,0.5);
            top:0;
        }
        .enter{
            width: 100%;
            background:#FFFFFF;
            z-index: 102;
            position: fixed;
            bottom:0;
            z-index: 102;
            height: 50%;

        }
        .enter-close{
            width: 100%;
            padding: 1% 0;
        }
        .enter-close i{
            width: 1.5em;
            height: 1.5em;
            display: block;
            float: right;
            margin-right: 3%;
            margin-top: 3%;
            font-style: normal;
        }
        .enter-text{
            width: 100%;
            text-align: center;
            color: #8D8D8D;
            border-bottom:2px solid #F5F5F5 ;
            padding: 2% 0;
            margin-bottom: 4%;
        }
        .enter-input{
            text-align: center;

        }
        .enter-input input{
            width: 90%;
            border: 1px solid #CCCCCC;
            padding: 2% 0;
            text-align: center;
            font-size: 16px;
            display: inline-block;

        }
        .queding{
            padding: 3%;
        }
        .queding span{
            width: 100%;
            display: block;
            background: #57d5f3;
            border-radius: 15px;
            color: #fff;
            padding: 5px 0;
            text-align: center;
        }
        </style>
	<body>
		<div class="select">
			<div>
				<div class="center select-t">
					<p>确认购买</p>
					<img src="../img/cancel.png" class="close">
				</div>
				<div class="select-b">
					<p>提示：报名即扣除1美金</p>
					<div class="flex top-up-box">
						<p id="m-number">账户余额：<span>￥300</span></p>
						<div class="top-up">去充值</div>
					</div>
					<div class="sure center">确定购买</div>
				</div>
			</div>
		</div>
		<header>
			<a href="javascript:history.back(-1)" class="back"><img src="../img/back.png" height="18px"></a>
			<div class="center title">会所详情</div>
		</header>
		<div class="club_wrap">
			
		</div>
		<div id="paymentpaw">

            <div class="enter">
                <div class="enter-close clearfix">
                    <i>x</i>
                </div>
                <div class="enter-text">请输入支付密码</div>
                <div class="enter-input">
                    <input type="password" name="pay" placeholder="输入支付密码">
                </div>

                <div class="queding"><span>确定发布</span></div>
            </div>
        </div>
		

		<script src="../js/jquery-3.3.1.js"></script>
		<script src="../layui/layui.js"></script>
        <script src="../layui/layui.all.js"></script>
		<script src="../js/details.js"></script>
	</body>
</html>	
<script type="text/javascript">
 function getUrlParam(name) {
            var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); //构造一个含有目标参数的正则表达式对象
            var r = window.location.search.substr(1).match(reg);  //匹配目标参数
            if (r != null) return unescape(r[2]); return null; //返回参数值
        }
        //接收URL中的参数id
        var id = getUrlParam('id');
        console.log(id);	

        $.ajax({
        	url:'/meiyou/selTuinaDetails',
        	type:'post',
        	data:'tId='+id,
        	success:function(data){
        		console.log(data);
        		$('.club_wrap').append(
        			"<img src='"+data.array[0]+"' width=\"100%\">" +
        			"<div class=\"club-wrap\">" +
        			"    <div class=\"flex club\">" +
        			"<div class=\"club-r\">" +
        			"<p class=\"username\">"+data.tName+"</p>" +
        			"<p class=\"flex score\">" +
        			"</p>" +
        			"<div class=\"flex distance\">" +
        			"<img src=\"../img/location.png\" height=\"14px\">" +
        			"<p>"+data.tAddress+"</p>" +
        			"</div>" +
        			"</div>" +
        			"    </div>" +
        			"    <div class=\"flex money\">" +
        			"    <div class=\"flex m-money\">" +
        			"    <div>" +
        			"    <p class=\"blue\">￥"+data.tMeijin+"</p>" +
        			"    <p>门市价：<span>￥"+data.tMsmeijin+"</span></p>" +
        			"    </div>" +
        			"    <div>" +
        			"    <p>"+data.tProduce+
        			"    <span class=\"commend\">荐</span>" +
        			"    </p>" +
        			"    <p>"+"已售"+data.tSell+"</p>" +
        			"    </div>" +
        			"    </div>" +
        			"    <div class=\"buy\">立即购买</div>" +
        			"    </div>" +
        			"    </div>"+
                    "<div class='c_img'>"+
                    "</div>"

                    );
                var score=data.tAssess;
                layui.use(['rate'], function(){
                    var rate = layui.rate;
                    rate.render({
                        elem: '.score',
                        value: score,
                        half: false,
                        text: true,
                        readonly: true,
                        setText: function(value){
                            this.span.text(value+'分');
                        }
                    });

                });

                $.each(data.array,function(i,val){
                    $('.c_img').append('<img src="'+val+'" width="50px" height="50px">')
                })

            }

        });
        $(document).on('click','.buy',function(){
        	$('.select').show();
        });
         $('.sure').click(function(){
            $(this).hide();
            $('#paymentpaw').show();
        });
        $('.enter-close').click(function(){
             $('#paymentpaw').hide();
             
        });
        $('.queding').click(function(){
            var uCount = localStorage.getItem("uCount");
             var pay=$('input[name="pay"]').val();
             $.post('/meiyou/tuinaApply',{
                    uCount:uCount,
                    pay:pay,
                    tId:id
             },function(data){
                console.log(data);
                 if(data.code==100){
                    layer.msg(data.msg,function(){
                    window.location.reload();
                });
                 }else{
                    layer.msg(data.msg);
                 }
             });
        });
        $.post('/meiyou/getMeijin',function(data){
        $('#m-number span').text("￥"+data.meijin);
    });
</script>